import { http } from "@/utils/http";

/**
 * 获取系统动态配置
 */
export const getAdminConfig = () => {
  return http.request<any>("get", "/api/admin/config/system/dynamic");
};

/**
 * 设置系统维护配置
 */
export const setAdminConfig = (data: { enabled: boolean; message: string }) => {
  return http.request<any>("post", "/api/admin/config/system/dynamic/maintenance", {
    data
  });
};
// 设置功能开关配置;
export const setAdminFeatures = (data: {
  notificationEnabled: boolean;
  globalNotificationEnabled: boolean;
}) => {
  return http.request<any>("post", "/api/admin/config/system/dynamic/features", {
    data
  });
};
// 设置API业务规则配置;
export const setAdminApiRules = (data: {
  timeoutSeconds: number;
  maxRetryAttempts: number;
  retryIntervalSeconds: number;
}) => {
  return http.request<any>("post", "/api/admin/config/system/dynamic/api-rules", {
    data
  });
};
// 设置支付系统配置;
export const setAdminPayment = (data: {
  orderExpireMinutes: number;
  maxOrderPerHour: number;
  minAmount: number;
  maxAmount: number;
  pointsRate: number;
}) => {
  return http.request<any>("post", "/api/admin/config/system/dynamic/payment", {
    data
  });
};
// 设置Telegram Bot配置
export const setAdminTelegramBot = (data: {
  token: string;
  name: string;
  enabled: boolean;
}) => {
  return http.request<any>(
    "post",
    "/api/admin/config/system/dynamic/telegram-bot",
    {
      data
    }
  );
};
// 清除系统动态配置缓存;
export const clearAdminDynamicConfigCache = () => {
  return http.request<any>("post", "/api/admin/config/system/dynamic/cache/clear");
};
